﻿<?php
/**
 * 添加题目界面
 *
 * @author kinet <380511703@qq.com>
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
 */

session_start();
require_once( 'path.php' );
require_once( SOJ_ROOT.'/include/function/lib.php');


$tpl = new my_smarty();

//若未登录,则重定向到登录界面
if( empty($_SESSION['admin']) ){

	$_SESSION['success_message'] = 'do not login yet , '.$_SESSION['admin'];
	header( 'Location:../manager/manager_login.php' );
	exit ;
}
//处理由其他页面保存在会话中的错误信息
if( !empty($_SESSION['errors']) ){

	$tpl->assign( 'errors' , $_SESSION['errors']  );
	//清除之前的错误信息
	unset( $_SESSION['errors'] );
}
try{
  $db=  db_connect();
  $problem=new problem_process($db);  
  $problem_no=$problem->get_Max_Problem_no()+1;//将本次的题目编号为题库最大编号加一
}
catch(Excption $e){
}
$tpl->assign('problem_no', $problem_no);
$tpl->assign('admin', $_SESSION['admin']);
$tpl->display('manager_problem_add.tpl');



